# Global properties for Visual Studio folder
IF(MSVC)
    set_property(GLOBAL PROPERTY USE_FOLDERS ON)
ENDIF()

# binaries and libraries output directory
IF(WIN32)
    IF(CMAKE_CL_64)
        SET(PLATDIR x64)
    ELSE()
        SET(PLATDIR Win32)
    ENDIF()
    set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/${PLATDIR})
ENDIF()
message(STATUS "CMAKE_INSTALL_PREFIX: " ${CMAKE_INSTALL_PREFIX})


# lib and bin
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/")
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/")
#message(STATUS "CMAKE_ARCHIVE_OUTPUT_DIRECTORY " ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
#message(STATUS "CMAKE_LIBRARY_OUTPUT_DIRECTORY " ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
#message(STATUS "CMAKE_RUNTIME_OUTPUT_DIRECTORY " ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
link_directories(${CMAKE_BINARY_DIR}/lib)
link_directories(${CMAKE_INSTALL_PREFIX}/lib)


# include default
message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../)
include_directories(${CMAKE_BINARY_DIR}/include)

# default build type [is Release]
IF(NOT CMAKE_BUILD_TYPE)
    SET(CMAKE_BUILD_TYPE "Release")
ENDIF()

message(STATUS "CMAKE_BUILD_TYPE " ${CMAKE_BUILD_TYPE})
IF(${CMAKE_BUILD_TYPE} MATCHES Debug)
    ADD_DEFINITIONS(-DDEBUG)
ELSE()
    ADD_DEFINITIONS(-DNDEBUG)
ENDIF()
